<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/jquery-3.3.1.min.js"></script>
</head>
<body>
    邮箱:<input type="text" id="mail"> <button onclick="sendMail()">发送</button> <br>
    验证码:<input type="text" id="code"> <br>
    <button onclick="zhuce()">注册</button>
</body>
</html>

<script>
    function sendMail() {
        var m  = $("#mail").val();
        $.get("/sendMail",{mail:m},function (res) {
            alert('发送成功');
        });
    }
    
    function zhuce() {
        var m  = $("#mail").val();
        var c =  $("#code").val();
        $.get("/checkCode",{mail:m,code:c},function (res) {

            if ("true"==$.trim(res))
            {
                alert("注册成功");
                return false;
            }

            alert("注册失败");
        });
    }

</script>